<%@page import="auxilary.Constants"%>
<%@page import="auxilary.Links"%>
<%@page import="entities.User"%>
<%@page import="java.util.List"%>
<%@page import="entities.Course"%>
<%@page import="auxilary.Actions"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	List<Course> courses = (List<Course>) request.getAttribute("courses");
	User user = (User) request.getSession().getAttribute("user");
	boolean loggedIn = (user != null);
	boolean isAdmin = (loggedIn) ? user.isAdmin() : false;
%>
<jsp:include page="/frames/start.jsp" />
	<%=Links.Css.COURSE %>
	<%=Links.Scripts.COURSE %>
	<%=Links.Scripts.COURSES %>
<jsp:include page="/frames/frame.jsp" />
			<div class="tops">
				<a class="top" href ="<%=Links.Pages.SEARCH %>">Search for courses</a>
			   <% if ((loggedIn) && (user.isAdmin())) { %>
				<a class="top" href ="<%=Links.Pages.NEW_COURSE %>">Add a new course</a>
			   <% } %>
			</div>
			<h1>All Courses</h1>
		   	<div class="tops">
		   		<form id="filters">
		   			<input type="hidden" value="<%=Actions.Course.COURSES_VIEW %>" name="action" />
		   		   <% if (loggedIn) { %>
			   		<div class="filter chosen" id="<%=Actions.Course.Type.AVAILABLE%>">Available To Me</div>
			   	   <% } %>
			   		<div class="filter<% if (!loggedIn) { %> chosen<% } %>" id="<%=Actions.Course.Type.ALL%>">All Courses</div>
			   		<div class="filter" id="<%=Actions.Course.Type.NOT_FULL%>">Not Full</div>
			   	   <% if ((loggedIn) && (isAdmin)) { %>
			   		<div class="filter" id="<%=Actions.Course.Type.MY_COURSES%>">Deletable Courses</div>
			   	   <% } %>
		   		</form>
		   	</div>
		   	<div class="wait">
		   		Please Wait...<br/>
		   		<img src="<%=Links.PROJECT_BASE %>images/wait.gif">
		   	</div>
		   	<div id="courses-table">
			</div>  	
<jsp:include page="/frames/end.jsp" />